home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-04-17 | 6.7 KB | 166 lines | [TEXT/KAHL] |
- File Dropper 1.1ß1
- Written by Troy Anderson
-
- Copyright © 1992-1993, Troy Anderson; All Rights Reserved
-
- What Is This Thing?
-
- File Dropper is a THINK C library that implements an application that you can drop files or
- folders onto to do batch operations on. It handles the getting of the AppleEvents if
- running under System 7, the main event loop, and the menus. You need only write the code
- that acts on the individual files.
-
- New Features in 1.1ß1
-
- • Now you can specify if you want the status dialog displayed while you are working on the files,
- wether they were selected with SFGetFile or an AppleEvent.
- • There is a progress bar like Finder 7's that you update by specifying how far along you are with
- a percentage (0 - 100). You can elect to turn this option off, too.
-
-
- How Do I Implement My Part?
-
- All definitions and prototypes that you need are in the "FD Interface.h" file. You simply write
- the ModuleMain function, and let the library do the rest.
-
- The ModuleMain function takes two parameters, a short and a ModuleDataRec. The short is a
- message that tells you why you were called. The ModuleDataRec is a record that contains data
- that you may need in order to perform the required task. It returns a Boolean value. The
- returned value is ignored in all but one case, when you are sent an eValidateFile message. See
- the eValidateFile message description below for details.
-
- Be sure that all of the resources in "File Dropper Starter π.rsrc" are included in the resource
- file for your project. It's easiest to make a copy of "File Dropper Starter π.rsrc" and use it.
-
- To allow dropping of different types of files/folders/volumes onto your application, change the
- 'FREF' resource to include the types of files you can act on. There are some special types that
- correspond to folders, volumes, etc. For a more indepth discussion of this, see section 9-17
- of Inside Macintosh Volume VI. See section 9-30 for a list of file types you can use for folders,
- floppy disks, the trash, etc.
-
- Be sure to change the creator type in the Set Project Type… menu of THINK C, and the creator
- type in the resource file, and to give your application a cool icon.
-
- What Is A ModuleDataRec?
-
- The ModuleDataRec is defined as follows:
-
- typedef struct {
- FSSpec *theFile; // a file specification
- long refcon; // a reference constant for you to do with what you will
- } ModuleDataRec;
-
- What Are The Messages?
-
- There are 6 possible messages, they are eStartup, eAEInitialize, eSFInitialize,
- eValidateFile, eProcessFile, eDispose, and eQuitting.
-
- You get the messages in this order:
-
- eStartup
- This tells you that the program just started up. You get this message exactly once.
- In the ModuleDataRec, theFile and refcon are initialize to NULL and 0 respectively. You
- are free to use refcon for anything you choose, including allocating a handle and saving
- its value in refcon so you can have additional storage. Nothing really precludes you from
- having global data hanging around, but someday this thing may evolve into a CODE resource
- interface that will make having globals more difficult. I never touch refcon, so what you
- do with it is up to you.
-
- This is a good place to call the customization routines like SetStatusParams,
- InstallCustomGetFSSpecFunc, InstallCustomFileFilterFunc, or InstallCustomDialogHookFunc,
- although it's all right to call them from eAEInitialize or eSFInitialize as well.
-
- eAEInitialize or eSFInitialize
- This tells you that a file/folder/volume has been selected by the user to be acted upon.
-
- eAEInitialize indicates that the file/folder/volume was "dropped" onto the application or
- sent to it using an 'odoc' AppleEvent.
-
- eSFInitialize indicates that the file (of folder or volume if you've installed a Custom
- GetFSSpec Function using InstallCustomGetFSSpecFunction()) was selected by the user using
- a standard get file dialog.
-
- It is handy to know wether the file was obtained from a "drop" or from a dialog if you have
- options based on keys pressed when "dropped," but not when obtainde from a dialog.
-
- You will receive one of these messages for each batch of files to be processed,
- before you are told to do any processing.
-
- In ModuleDataRec, theFile is meaningless during this message.
-
- eValidateFile
- This asks you if the file specified in the theFile parameter of the ModuleDataRec record
- is valid for you to work on. I.E. should eProcessFile be sent? Return TRUE if you want
- to process it, otherwise return FALSE.
-
- eProcessFile
- This tells you to do your thing. You get this message for each file in the batch. The
- ModuleDataRec will contain a pointer to the FSSpec for the file that you are to process
- in the theFile parameter.
-
- eDispose
- This tells you that the batch is finished. This balances out the eAEInitialize or
- eSFInitialize messages. It gives you a chance to clean up any data structures you
- set up there.
-
- In ModuleDataRec, theFile is meaningless.
-
- eQuitting
- This tells you that the application is about to quit. If you need to save or flush anything,
- this is the time to do it.
-
- In ModuleDataRec, theFile is meaningless.
-
-
- In summary:
-
- eStartup
- REPEAT AS LONG AS USER SELECTS THINGS FROM THE GET FILE DIALOG
- eSFInitialize
- REPEAT FOR EACH FILE
- eValidateFile
- eProcessFile (if validation succeeded)
- END REPEAT
- eDispose
- END REPEAT
- eQuitting
-
- -OR-
-
- eStartup
- eAEInitialize
- REPEAT FOR EACH FILE
- eValidateFile
- eProcessFile (if validation succeeded)
- END REPEAT
- eDispose
- eQuitting
-
-
-
- About The Guy Who Wrote It
-
- This was written by me, Troy Anderson, after a comment from a user of Marker that wanted source
- so he could do something else with the files that were dropped on the application. This allows
- you to create little utility applications that do fun things. If you really like this, and you
- write software, send me a copy of it. Thanks.
-
- Internet: tla@netcom.com
- Compuserve: 70410,1407
- America Online: Troy A1
- US Mail: Troy Anderson
- 5550 East Roadrunner Road
- Paradise Valley, AZ 85253
-
- Legal Stuff
-
- If you like it, let me know. If you want to pay for it, send me money. If there are bugs, tell
- me, I may actually fix them. Every effort has been made to ensure that this software
- works as specified, but it has no warranties, expressed or implied, as to its usefulness,
- stability, or functionalty. Use this software at your own risk.
-
- You may use and distribute applications made with File Dropper at no charge, but you may not
- sell them, or collect money for their distribution (normal disk duplication fees excepted).
- Anyone wishing to distribute an application using File Dropper along with any commercial or
- shareware software package may do so only with my express written consent.
-